﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SiGeSIB.Data.Management;
using SiGeSIB.DataFactory;
using SiGeSIB.Data.Providers;
using SiGeSIB.Business.Impl.Providers;

namespace SiGeSIB.Business.Impl
{
	public class ManagementController : BaseController
	{
		public int InsertContributor(Contributor contributor)
		{
			IManagementDataProvider manProv = _DataProvider.CreateManagementDataProvider();
			return manProv.InsertContributor(contributor);
		}
		public void UptateContributor(Contributor contributor)
		{
			IManagementDataProvider manProv = _DataProvider.CreateManagementDataProvider();
			manProv.UpdateContributor(contributor);
		}
		public void RemoveContributor(int id)
		{
			IManagementDataProvider manProv = _DataProvider.CreateManagementDataProvider();
			manProv.RemoveContributor(id);
		}

		public Contributor GetContributor(int id)
		{
			IManagementDataProvider manProv = _DataProvider.CreateManagementDataProvider();

			return manProv.GetContributor(id);
		}
		public List<Contributor> GetContributors()
		{
			return GetContributors(EContributorType.Visitor | EContributorType.Member | EContributorType.Contributor);
		}
		public List<Contributor> GetContributors(EContributorType type)
		{
			IManagementDataProvider manProv = _DataProvider.CreateManagementDataProvider();

			return manProv.GetContributors(type);
		}
		public List<Contributor> GetContributors(int[] ids)
		{
			IManagementDataProvider manProv = _DataProvider.CreateManagementDataProvider();

			return manProv.GetContributors(ids);
		}

		public Dictionary<string, Address> GetAddresses()
		{
			IManagementDataProvider manProv = _DataProvider.CreateManagementDataProvider();
			return manProv.GetAddresses();
		}
	}
}
